﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;


namespace SHRIS.MIS.Entity.ScadaData
{
    [Table("tb_deviceAlarm")]
    public class DeviceAlarmEntity : BaseScadaEnetity
    {
        /// <summary>
        /// 报警ID
        /// </summary>
        [Key]
        [Column("DeviceAlarmId")]
        public Guid Id { get; set; }

        /// <summary>
        /// 设备编码
        /// </summary>
        [Required]
        public string DeviceCode { get; set; }

        /// <summary>
        /// 故障码；DeviceCatalog*10000+ AlarmGroup*100+index
        /// </summary>
        [Required]
        public int AlarmCode { get; set; }


        /// <summary>
        /// 报警文本
        /// </summary>
        [Required]
        public string AlarmText { get; set; }

        /// <summary>
        /// 报警类型 0-未定义 1-故障停机；2-报警警告
        /// </summary>
        [Required]
        public int AlarmType { get; set; }

        /// <summary>
        /// 1:报警产生  0： 报警恢复
        /// </summary>
        [Required]
        public int OPType { get; set; }


        /// <summary>
        /// 菜单图标
        /// </summary>
        [Required]
        public DateTimeOffset OccurTime { get; set; }


        public override string ToString()
        {
            return string.Format("设备：{0} ： {1}==》{2}  {3}", DeviceCode, AlarmText, OPType.ToString(), OccurTime.ToString());
        }
    }
}
